Quantifying effect of planting dates on potential potato yield
A crop modeling approach
Background
This R markdown notebook aims to document the simulation exercise performed by Ramírez et al. (2024). The SOLANUM model was used to determine the potential potato yield (Yp) and “roughly” quantify the effect of planting dates on Yp. The model was calibrated using the SOLANUM’s Parameter Estimator and fed with weather data from NASA POWER
Load libraries and extra R-files
# libraries
library(nasapower)
library(meteor)
library(lubridate)
library(dplyr)
# extra R-files
load(url("https://github.com/jninanya/Ramirez-et-al-2024/raw/main/solanumR/CropParamsList.Rdata"))
source("https://raw.githubusercontent.com/jninanya/Ramirez-et-al-2024/main/solanumR/thermalTime.R")
source("https://raw.githubusercontent.com/jninanya/Ramirez-et-al-2024/main/solanumR/SolanumModel.R")Weather data retrieving
# define variables (wvars) and period
wvars <- c("T2M_MAX", "T2M_MIN", "ALLSKY_SFC_SW_DWN")
period <- c("2000-01-01", "2023-12-31")
# coordinates (lon, lat) of the Fultola location
FUL <- c(89.5262, 22.7088)
# get daily data from NASA POWER
wdata <- get_power(
community = "ag",
lonlat = FUL,
pars = wvars,
dates = period,
temporal_api = "daily"
)
# change column names and photoperiod computation
colnames(wdata)[8:10] <- c("TMAX", "TMIN", "SRAD")
wdata$DATE <- wdata$YYYYMMDD
wdata$SUNSH <- photoperiod(wdata$DOY, wdata$LAT)
# CLIMATIC CONDITIONS FOR THE 2000-2020 PERIOD
# average wdata by DOY
smr_ave <- wdata[wdata$YEAR >= 2000 & wdata$YEAR <= 2020, ] %>%
group_by(DOY) %>%
summarise_at(c("TMAX", "TMIN", "SRAD"), mean, na.rm = TRUE)
# quantile 10
smr_q10 <- wdata[wdata$YEAR >= 2000 & wdata$YEAR <= 2020, ] %>%
group_by(DOY) %>%
summarise_at(c("TMAX", "TMIN", "SRAD"), quantile, probs = 0.10, na.rm = TRUE)
# quantile 90
smr_q90 <- wdata[wdata$YEAR >= 2000 & wdata$YEAR <= 2020, ] %>%
group_by(DOY) %>%
summarise_at(c("TMAX", "TMIN", "SRAD"), quantile, probs = 0.90, na.rm = TRUE)
# select DOY from 1 to 365 (DOY = 366 is not considered)
smr_ave <- smr_ave[1:365,]
smr_q10 <- smr_q10[1:365,]
smr_q90 <- smr_q90[1:365,]Climatic condition show XX. Click on code to see the R
chunk code for the plot below.
# general plot settings
par(oma = c(2.5, 3.5, 0.5, 3.5), # general margins
mfrow = c(1, 2), # number of sub-figures
mar = c(0, 0.25, 0, 0.25), # margins per sub-figure
ps = 10, # text font size
family = "serif", # text family
lwd = 1.0, # line width
las = 1, # style of axis labels
pch = 20 # plotting points
)
# x-axis tick marks and labels
x <- smr_ave$DOY
xtick <- c(15, 75, 136, 197, 259, 320)
xlabs <- c("JAN", "MAR", "MAY", "JUL", "SEP", "NOV")
# PLOT MINIMUM AND MAXIMUM TEMPERATURES
# create an empty plot
plot(x = 0, y = 0, xlim = c(1, 365), ylim = c(5, 45), xlab = "", ylab = "",
type = "l", axes = FALSE)
box()
axis(1, at = xtick, labels = xlabs)
axis(2, las = 1)
mtext(side = 2, text = quote("Temperature (°C)"),
las = 0, line = 2.4, cex = 1.5)
# add minimum temperature to empty plot
polygon(c(x, rev(x)), c(smr_q90$TMIN, rev(smr_q10$TMIN)), col = "#ffb2b2")
lines(x, smr_ave$TMIN, col = "#FF0000", lwd = 2)
lines(x, smr_q10$TMIN, col = "#ffb2b2")
lines(x, smr_q90$TMIN, col = "#ffb2b2")
# add maximum temperature to empty plot
polygon(c(x, rev(x)), c(smr_q90$TMAX, rev(smr_q10$TMAX)), col = "#b2b2ff")
lines(x, smr_ave$TMAX, col = "#0000FF", lwd = 2)
lines(x, smr_q10$TMAX, col = "#b2b2ff")
lines(x, smr_q90$TMAX, col = "#b2b2ff")
# add legend
legend(x = "topright", legend = c("TMAX", "TMIN"),
col = c("#0000FF", "#FF0000"), lty = 1, cex = 0.8, lwd = 1.5)
# PLOT SOLAR RADIATION
# create an empty plot
plot(x = 0, y = 0, type = "l", xlim = c(1, 365), ylim = c(0, 30),
xlab = "", ylab = "", axes = FALSE)
box()
axis(1, at = xtick, labels = xlabs)
axis(4, las = 1)
mtext(side = 4, text = quote("Radiation (MJ m"^{-2}*")"),
las = 0, line = 2.4, cex = 1.5)
# add solar radiation data to empty plot
polygon(c(x, rev(x)), c(smr_q90$SRAD, rev(smr_q10$SRAD)), col = "#e8cfb4")
lines(x, smr_ave$SRAD, col = "#B45F06", lwd = 2)
lines(x, smr_q10$SRAD, col = "#e8cfb4")
lines(x, smr_q90$SRAD, col = "#e8cfb4")
# add legend
legend(x = "topright", legend = "SRAD", col = "#B45F06",
lty = 1, cex = 0.8, lwd = 1.5)ddd
# data for model calibration
climate <- apply(smr_ave, 2, rep, 2)
climate <- as.data.frame(climate)
year1 = fromDoy(climate$DOY[1:365], 2021)
year2 = fromDoy(climate$DOY[366:730], 2022)
climate$day <- NULL
climate$month <- NULL
climate$year <- NULL
climate$day[1:365] <- day(year1)
climate$day[366:730] <- day(year2)
climate$month[1:365] <- month(year1)
climate$month[366:730] <- month(year2)
climate$year[1:365] <- year(year1)
climate$year[366:730] <- year(year2)
climate <- climate[,c("day", "month", "year", "DOY", "TMAX", "TMIN", "SRAD")]SOLANUM model calibration
The SOLANUM model has a tool called Parameter Estimator which translates expert knowledge about the crop phenology into the model parameters. This tool is based on allometric and heuristic methods that relate mathematical functions of the vegetative (canopy cover) and reproductive (tuber partitioning) crop growth with the parameters of the model. This tool is based on the following 3 principles:
- Use generic mathematical functions to describe either canopy cover or tuber formation, regardless of varieties or environmental conditions, but with specific parameters that vary depending on varieties.
- Apply numerical methods to estimate specific parameters by forcing the function to fit a minimum number of data points.
- The pre-defined minimum number of data points needed to fit the functions must be obtained from expert knowledge. This comprises sowing and harvest dates, day of emergence, day of the maximum canopy cover, maximum canopy cover index, day of physiological maturity, and day of tuber initiation.
More details about the Parameter Estimator tool can be found in Harahagazwe et al. (2018).
| DESCRIPTION | BARI-ALU72 | BARI-ALU78 |
|---|---|---|
| Distance between plants (cm) | 25 | 25 |
| Distance between rows (cm) | 60 | 60 |
| Planting date | 11th November | 11th November |
| Emergency day (DAP) | 12 | 14 |
| Tuber initiation onset (DAP) | 35 | 35 |
| Time when plant reach its maximum canopy cover (DAP) | 60 | 60 |
| Harvest day (DAP) | 90 | 90 |
| Approximate value of the maximum canopy cover (fraction) | 0.92 | 0.85 |
| Yield at 70 DAP (t/ha) | 28 | 25 |
| Yield at harvest day (t/ha) | 35 | 32 |
| Dry matter concentration (%) | 22.50 | 21.54 |
The Parameter Estimated tool was run with using information about
crop phenology from literature (Mahmud et al. 2021, Islam et al. 2022)
and from expert knowdledge (R. Ebna and H. Monower; personal
comunication; 6 February 2024). Values of the crop parameters for both
varieties were saved in CropParamsList.Rdata. Let’s see
them in the following R chunk code:
load(url("https://github.com/jninanya/Ramirez-et-al-2024/raw/main/solanumR/CropParamsList.Rdata"))
CropParamsList$BariAlu72
## wmax tm te A tu b RUE DMc
## 0.90 330.00 870.00 0.75 650.00 190.00 3.22 0.20
## attr(,"CropParamsInfo")
## [1] "wmax : Maximum canopy cover index (fraction)"
## [2] "tm : Thermal time at the maximum canopy cover growth rate (C-day)"
## [3] "te : Thermal time at the maximum canopy cover value (C-day)"
## [4] "A : Maximum harvest index (fraction)"
## [5] "tu : Thermal time at maximum tuber partition rate (C-day)"
## [6] "b : Thermal time just before the tuber initiation process (C-day)"
## [7] "RUE : Average radiation use efficiency (g/MJ)"
## [8] "DMc : Dry matter concentration of tubers (fraction)"
## attr(,"VarietyName")
## [1] "BariAlu72"
CropParamsList$BariAlu78
## wmax tm te A tu b RUE DMc
## 0.90 330.00 870.00 0.75 650.00 190.00 3.22 0.20
## attr(,"CropParamsInfo")
## [1] "wmax : Maximum canopy cover index (fraction)"
## [2] "tm : Thermal time at the maximum canopy cover growth rate (C-day)"
## [3] "te : Thermal time at the maximum canopy cover value (C-day)"
## [4] "A : Maximum harvest index (fraction)"
## [5] "tu : Thermal time at maximum tuber partition rate (C-day)"
## [6] "b : Thermal time just before the tuber initiation process (C-day)"
## [7] "RUE : Average radiation use efficiency (g/MJ)"
## [8] "DMc : Dry matter concentration of tubers (fraction)"
## attr(,"VarietyName")
## [1] "BariAlu78"Thermal time computing
################################################################################
# 3. Thermal time computing
################################################################################
year0 = 2000
year1 = 2022
n <- as.Date("2023-01-31")-as.Date("2022-11-01")+1
m <- year1-year0+1
#wdata <- wdata[wdata$YEAR>=year0 & wdata$YEAR<=year1,]
out0 <- as.data.frame(matrix(nrow = n, ncol = m))
out1 <- as.data.frame(matrix(nrow = n, ncol = m))
out2 <- as.data.frame(matrix(nrow = n, ncol = m))
yy = seq(year0, year1, by = 1)
# load extra functions
weather <- wdata
#for(jj in 1:m){
#
# date0 = as.Date(paste0(yy[jj], "-11-01"))-1
#
# for(ii in 1:n){
#
#
# sDate = as.Date(date0 + ii)
# sDate.name = paste(month(sDate), day(sDate), sep = "-")
# out0[ii, jj] = as.character(sDate)
#
# sowing = sDate
# harvest = sowing + 90
# ndays = as.numeric(harvest-sowing)+1
#
### variety Bari Alu 72
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/BARI-Alu-72.R")
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/Module_PotentialGrowth_V2.0.R")
#
# out1[ii, jj] = ifelse(df$fty[ndays]>20, df$fty[ndays], NA)
#
### variety Bari Alu 78
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/BARI-Alu-78.R")
# source("https://raw.githubusercontent.com/jninanya/Ramirez-et-a#l-2024/main/solanumR/Module_PotentialGrowth_V2.0.R")
#
# out2[ii, jj] = ifelse(df$fty[ndays]>20, df$fty[ndays], NA)
#
# rownames(out0)[ii] = sDate.name
# rownames(out1)[ii] = sDate.name
# rownames(out2)[ii] = sDate.name
# }
#
# colnames(out0)[jj] = yy[jj]
# colnames(out1)[jj] = yy[jj]
# colnames(out2)[jj] = yy[jj]
#
#}
#d1 <- out1
#d2 <- out2
#
#boxplot(t(d1), col = "green", outline = FALSE, las=1,
# ylab = "potential yield (t/ha)")
#
#boxplot(t(d2), col = "red", outline = FALSE, las=1,
# ylab = "potential yield (t/ha)")
#
#
### plot fty by planting date
#x <- 1:92
#fty_mean <- apply(out1, 1, mean, na.rm = TRUE)
#fty_q10 <- apply(out1, 1, quantile, probs = 0.10, na.rm = TRUE)
#fty_q90 <- apply(out1, 1, quantile, probs = 0.90, na.rm = TRUE)
#
#
##--------------------------------------------------
##--------------------------------------------------
#### General figure settings
#par(oma = c(4, 1, 0.5, 0.5), # general margins
# mfrow = c(2, 1), # number of sub-figures
# mar = c(0,3,0,0), # margins per sub-figure
## ps = 10, # text font size
# family = "serif" # text family
## lwd = 0.5, # line width
## las = 1, # style of axis labels
## pch = 20 # plotting points
#)
#
#x=1:90
#y1=d1$`2021`[1:90]
#y2=d2$`2021`[1:90]
#plot(x, y1, type = "l", xlim = c(1,92), ylim = c(23,57),
# xlab = "", ylab = "potential yield (t/ha)", axes = FALSE,
# lwd = 2)
#box()
#lines(x, y2, lwd = 2, col = "gray50")
#
##axis(1, at = c(5,15,25,35,45,55,66,76,86), las = 2,
## labels = c("5-nov","15-nov","25-nov","5-dec","15-dec","25-dec#","5-jan","15-jan","25-jan"))
##axis(1, las = 1, at = seq(5, 90, by=10))
#axis(2, las = 1, at=seq(25,55,by=5))
#abline(v=50, lty = 2, col = "blue")
#abline(v=74, lty = 2, col = "blue")
#
#text(47, 55.5, "ZT", col = "blue")
#text(71, 55.5, "CT", col = "blue")
#
#text(0, 55.5, expression(bold("A")))
#mtext(side=2, text=bquote("yield (t ha"^{"-1"}*")"), cex = 1.5, #line = 2.4)
#
####
#x=1:85
#y1=d1$`2022`[1:85]
#y2=d2$`2022`[1:85]
#plot(x, y1, type = "l", xlim = c(1,92), ylim = c(23,52),
# xlab = "", ylab = "potential yield (t/ha)", axes = FALSE,
# lwd = 2)
#box()
#lines(x, y2, lwd = 2, col = "gray50")
#
#axis(1, at = c(5,15,25,35,45,55,66,76,86), las = 2,
# labels = c("05-nov","15-nov","25-nov","05-dec","15-dec","25-de#c","05-jan","15-jan","25-jan"))
##axis(1, las = 1, at = seq(5, 90, by=10))
#axis(2, las = 1, at=seq(25,50,by=5))
#abline(v=44, lty = 2, col = "blue")
#abline(v=62, lty = 2, col = "blue")
#
#text(41, 51, "ZT", col = "blue")
#text(59, 51, "CT", col = "blue")
#
#text(0, 51, expression(bold("B")))
#
#mtext(side=2, text=bquote("yield (t ha"^{"-1"}*")"), cex = 1.5, #line = 2.4)
#